package com.itic.web.ro;


public class DataResult {
	
	private PageInfo page;
	// 响应消息
	private Integer code;
	// 响应消息
	private String message;
	// 响应中的数据
	private Datas datas;
	
	public static DataResult build(Integer code, String msg, Datas data,PageInfo page) {
		return new DataResult(code, msg, data,page);
	}
	public static DataResult build(Integer code, String msg, Datas data) {
		return new DataResult(code, msg, data);
	}

	public static DataResult build(Integer code, String msg) {
		return new DataResult(code, msg, null);
	}

	public static DataResult ok(Integer code,Datas data) {
		return new DataResult(code,data);
	}

	public static DataResult ok(Integer code) {
		return new DataResult(code,null);
	}

	public static DataResult error(Integer code,String errorMessage) {
		return new DataResult(code, errorMessage, null);
	}
	
	public DataResult() {

	}

	/**
	 * 
	 * @param 有参构造
	 * @param msg
	 * @param data
	 */
	public DataResult(Integer code, String msg, Datas data) {
		this.message = msg;
		this.datas = data;
		this.code = code;
	}
	/**
	 * 
	 * @param 有参构造1
	 * @param msg
	 * @param data
	 */
	public DataResult(Integer code, String msg, Datas data,PageInfo page) {
		this.message = msg;
		this.datas = data;
		this.code = code;
		this.page = page;
	}

	public DataResult(Integer code,Datas data) {
		this(code, "OK", data);
	}
	
	public String getMessage() {
		return message;
	}

	public void setMessage(String msg) {
		this.message = msg;
	}

	public Datas getDatas() {
		return datas;
	}
	public void setDatas(Datas datas) {
		this.datas = datas;
	}
	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
	public PageInfo getPage() {
		return page;
	}
	public void setPage(PageInfo page) {
		this.page = page;
	}
	

}
